/**
 * childNodes：获取所有的节点
 * nodeType：1 元素节点 2 属性节点 3 文本节点
 * nodeValue：节点值
 * firstChild
 * lastChild
 */
var imgPlace = document.getElementById("img_place");
var pPlace = document.getElementById("p_place");
function showPic(whichPic) {
    var picSrcPath = whichPic.getAttribute("href");
    var title = whichPic.getAttribute("title");
    imgPlace.setAttribute("src", picSrcPath);
    pPlace.firstChild.nodeValue=title;
}

//统计元素数量
window.onload = countBodyNodesCount();
function countBodyNodesCount() {
    var bodyNodes = document.body.childNodes;
    var count = document.body.childNodes.length;
    var str = "body 元素总数："+count;
    for(var i =0 ; i<count;i++){
        str+="\n第"+i+"类型:"+bodyNodes[i].nodeType;
    }
    alert(str);
}